package com.igeek.d0618.test3;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @Author: zhiyu
 * @Date:17:43
 * @DESC:
 */
public class ReflectDemo2 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<Student> studentClass = Student.class;
        Constructor<Student> constructor = studentClass.getConstructor(String.class,Integer.class);
        Student student = constructor.newInstance("张三", 23);
        System.out.println("student.toString() = " + student.toString());
    }
}
